import Vue from 'vue'
import Vuex from 'vuex'
// 数据持久化
import VuexPersistence from 'vuex-persist'
const vuexLocal = new VuexPersistence({
  storage: window.sessionStorage
})

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
	 token:"",
	 userinfo:{},
	 loading:false,
	 // 面包屑
	 bread:[],
  },
  mutations: {
	  // 设置token
    SetToken(state,data){
		state.token=data.token;
		state.userinfo=data;
	},
	// 退出登录
	logOut(state){
		state.token="";
		state.userinfo={};
	},
	// 设置loading效果
	setLoading(state,status){
		state.loading=status;
	},
	// 设置面包屑
	setBread(state,bread){
		state.bread=bread;
	}
  },
  actions: {

  },
   plugins: [vuexLocal.plugin]
})
